package com.hrt.datasender.datadao.model;

import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.List;

import com.btcode.common.StringUtil;
import com.btcode.exception.MsgException;
import com.btcode.orm.model.IDomainField;
import com.btcode.orm.model.IField;
import com.btcode.orm.model.IModelAddition;
import com.btcode.orm.relation.ex.IRelation;

public class BdSourceReadRecordModelAddition implements IModelAddition<BdSourceReadRecordModel>, Serializable {

    /**
     * 
     */
    private static final long serialVersionUID = 1L;

    @Override
    public void generateDefaultValue(BdSourceReadRecordModel model) {

        if (model.getLastReadTime() == null) {
            throw new MsgException("LastReadTime不能为空");
        }

        SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd_HH:mm:ss");

        if (StringUtil.isEmpty(model.getLastReadTimeText())) {
            String lastReadTimeText = sf.format(model.getLastReadTime());
            model.setLastReadTimeText(lastReadTimeText);
        }
    }

    @Override
    public void initField(List<IField> fields) {
        // TODO Auto-generated method stub

    }

    @Override
    public void initRelations(List<IRelation> relations) {
        // TODO Auto-generated method stub

    }

    @Override
    public void initDomainField(List<IDomainField> domainFields) {
        // TODO Auto-generated method stub

    }

    @Override
    public void beforeCreate(BdSourceReadRecordModel model) {
        // TODO Auto-generated method stub

    }

    @Override
    public void afterCreate(BdSourceReadRecordModel model) {
        // TODO Auto-generated method stub

    }

    @Override
    public void beforeUpdate(BdSourceReadRecordModel model) {
        // TODO Auto-generated method stub

    }

    @Override
    public void afterUpdate(BdSourceReadRecordModel model) {
        // TODO Auto-generated method stub

    }

    @Override
    public void beforeDelete(BdSourceReadRecordModel model) {
        // TODO Auto-generated method stub

    }

    @Override
    public void afterDelete(BdSourceReadRecordModel model) {
        // TODO Auto-generated method stub

    }

}
